<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>axipcie: xaxipcie_rc_cdma_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">axipcie
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xaxipcie__rc__cdma__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xaxipcie_rc_cdma_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example for using AXI PCIe IP and its driver. </p>
<p>This is an example to show the usage of driver APIs when AXI PCIe IP is configured as a Root Port. The AXI PCIe can be configured as a Root Port only on the 7 Series Xilinx FPGA families.</p>
<p>The example initialises the AXI PCIe IP, shows how to enumerate the PCIe system and transfer data between endpoint and root complex using Central DMA.</p>
<p>This example assumes that there is an AXI CDMA IP in the system. The user has to specify the Source, Destination and the Length of the DMA transfer which are valid for this system and are defined AXICDMA_SRC_ADDR, AXICDMA_DEST_ADDR and AXICDMA_LENGTH respectively in this example.</p>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>This example should be used only when AXI PCIe IP is configured as root complex and AXI CDMA IP in included in system.</p>
<p>This code will illustrate how the <a class="el" href="struct_x_axi_pcie.html" title="The XAxiPcie driver instance data. ">XAxiPcie</a> IP and its standalone driver can be used to:</p>
<ul>
<li>Initialize a AXI PCIe IP core built as a root complex.</li>
<li>Enumerate PCIe end points in the system.</li>
<li>Transfer data between root complex and endpoint using CDMA.</li>
</ul>
<p>Please note that this example enumerates and initializes PCIe end points only. It does not shows how to deal with PCIe switches (and its virtual P2P bridges)</p>
<p>We tried to use as much of the driver's API calls as possible to show the reader how each call could be used and that probably made the example not the shortest way of doing the tasks shown as they could be done.</p>
<pre>
  MODIFICATION HISTORY:</pre><pre>  Ver   Who  Date     Changes
</p>
<hr/>
<p>
  2.00a nm   10/19/11 Initial version of AXI PCIe Root Port example
  3.1   ms   01/23/17 Added xil_printf statement in main function to
                      ensure that "Successfully ran" and "Failed" strings
                      are available in all examples. This is a fix for
                      CR-965028.
        ms   04/05/17 Added tabspace for return statements in functions
                      for proper documentation while generating doxygen.</pre><pre>*</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae4d64f629bd35e874ac76b2e7159b73f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxipcie__rc__cdma__example_8c.html#ae4d64f629bd35e874ac76b2e7159b73f">PcieInitRootComplex</a> (<a class="el" href="struct_x_axi_pcie.html">XAxiPcie</a> *AxiPciePtr, u16 DeviceId)</td></tr>
<tr class="memdesc:ae4d64f629bd35e874ac76b2e7159b73f"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function initializes a AXI PCIe IP built as a root complex.  <a href="#ae4d64f629bd35e874ac76b2e7159b73f">More...</a><br/></td></tr>
<tr class="separator:ae4d64f629bd35e874ac76b2e7159b73f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a01838eb2ef6647eade95ec664ea99543"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxipcie__rc__cdma__example_8c.html#a01838eb2ef6647eade95ec664ea99543">PCIeEnumerateFabric</a> (<a class="el" href="struct_x_axi_pcie.html">XAxiPcie</a> *AxiPciePtr)</td></tr>
<tr class="memdesc:a01838eb2ef6647eade95ec664ea99543"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function enumerates its PCIe system and figures out the nature of each component there like end points,bridges,...  <a href="#a01838eb2ef6647eade95ec664ea99543">More...</a><br/></td></tr>
<tr class="separator:a01838eb2ef6647eade95ec664ea99543"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa948ae443a3c8a8bfd08560dd1a0c199"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxipcie__rc__cdma__example_8c.html#aa948ae443a3c8a8bfd08560dd1a0c199">DmaDataTransfer</a> (u16 DeviceID)</td></tr>
<tr class="memdesc:aa948ae443a3c8a8bfd08560dd1a0c199"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function transfers data from Source Address to Destination Address using the AXI CDMA.  <a href="#aa948ae443a3c8a8bfd08560dd1a0c199">More...</a><br/></td></tr>
<tr class="separator:aa948ae443a3c8a8bfd08560dd1a0c199"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxipcie__rc__cdma__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is the entry point for PCIe Root Complex Enumeration Example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br/></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="aa948ae443a3c8a8bfd08560dd1a0c199"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int DmaDataTransfer </td>
          <td>(</td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>DeviceID</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function transfers data from Source Address to Destination Address using the AXI CDMA. </p>
<p>User has to specify the Source Address, Destination Address and Transfer Length in AXICDMA_SRC_ADDR, AXICDMA_DEST_ADDR and AXICDMA_LENGTH defines respectively.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">DeviceId</td><td>is device ID of the XAxiCdma Device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful</li>
<li>XST_FAILURE.if unsuccessful.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the hardware system is not built correctly this function may never return to the caller. </dd></dl>

</div>
</div>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is the entry point for PCIe Root Complex Enumeration Example. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful</li>
<li>XST_FAILURE if unsuccessful.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xaxipcie__ep__cdma__example_8c.html#aa948ae443a3c8a8bfd08560dd1a0c199">DmaDataTransfer()</a>, <a class="el" href="xaxipcie__rc__cdma__example_8c.html#a01838eb2ef6647eade95ec664ea99543">PCIeEnumerateFabric()</a>, and <a class="el" href="xaxipcie__rc__cdma__example_8c.html#ae4d64f629bd35e874ac76b2e7159b73f">PcieInitRootComplex()</a>.</p>

</div>
</div>
<a class="anchor" id="a01838eb2ef6647eade95ec664ea99543"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void PCIeEnumerateFabric </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_axi_pcie.html">XAxiPcie</a> *&#160;</td>
          <td class="paramname"><em>AxiPciePtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function enumerates its PCIe system and figures out the nature of each component there like end points,bridges,... </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AxiPciePtr</td><td>is a pointer to an instance of <a class="el" href="struct_x_axi_pcie.html" title="The XAxiPcie driver instance data. ">XAxiPcie</a> data structure represents a root complex IP.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="group__axipcie.html#ga0899628f4ecfb6d3b05671933c375ae5">XAxiPcie_GetRootPortStatusCtrl()</a>, <a class="el" href="group__axipcie.html#gae4aafc6b1766352ed5347e40762f0649">XAxiPcie_ReadRemoteConfigSpace()</a>, <a class="el" href="group__axipcie.html#ga7239a578a5e3bbf80fac05bab9a841aa">XAXIPCIE_RPSC_BRIDGE_ENABLE_MASK</a>, <a class="el" href="group__axipcie.html#ga2860cd7b0180a99fb324c085fc8fa746">XAxiPcie_SetRootPortStatusCtrl()</a>, and <a class="el" href="group__axipcie.html#gadb4d67df95f1c7b0010e370312283f22">XAxiPcie_WriteRemoteConfigSpace()</a>.</p>

<p>Referenced by <a class="el" href="xaxipcie__rc__cdma__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a class="anchor" id="ae4d64f629bd35e874ac76b2e7159b73f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int PcieInitRootComplex </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_x_axi_pcie.html">XAxiPcie</a> *&#160;</td>
          <td class="paramname"><em>AxiPciePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>DeviceId</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function initializes a AXI PCIe IP built as a root complex. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AxiPciePtr</td><td>is a pointer to an instance of <a class="el" href="struct_x_axi_pcie.html" title="The XAxiPcie driver instance data. ">XAxiPcie</a> data structure represents a root complex IP. </td></tr>
    <tr><td class="paramname">DeviceId</td><td>is AXI PCIe IP unique ID</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XST_FAILURE if unsuccessful.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="struct_x_axi_pcie___config.html#a98bdcba67cfa7c75179ae1b0b7b6415f">XAxiPcie_Config::BaseAddress</a>, <a class="el" href="struct_x_axi_pcie.html#ab87e6544d15c1c11d8aaba5021606363">XAxiPcie::Config</a>, <a class="el" href="struct_x_axi_pcie___config.html#a9cf8eebd3200725c2102ea9c1a5aea28">XAxiPcie_Config::IncludeRootComplex</a>, <a class="el" href="group__axipcie.html#ga6eaa13c68af6eb2ca12ae556f9e0769b">XAxiPcie_CfgInitialize()</a>, <a class="el" href="group__axipcie.html#gabdf66d0cb481a5eea62e1f98e71d9520">XAxiPcie_ClearPendingInterrupts()</a>, <a class="el" href="group__axipcie.html#gae238cf115bd039e0f7228e385c893aad">XAxiPcie_DisableInterrupts()</a>, <a class="el" href="group__axipcie.html#gae118e9d7fd6b78ca0b8d4fd6694f9808">XAxiPcie_GetEnabledInterrupts()</a>, <a class="el" href="group__axipcie.html#ga19d8a1973231160bdd518b1c62bda3d4">XAxiPcie_GetLocalBusBar2PcieBar()</a>, <a class="el" href="group__axipcie.html#gaec39c65db1aeac38798a250a25298208">XAxiPcie_GetPendingInterrupts()</a>, <a class="el" href="group__axipcie.html#ga77063428b5641d07910419770813c148">XAxiPcie_GetRequesterId()</a>, <a class="el" href="group__axipcie.html#gaeb7c330e5d10623ceafc66dd08f149ea">XAXIPCIE_ID_CLEAR_ALL_MASK</a>, <a class="el" href="group__axipcie.html#ga40d5e3c669642af8441aed4d5ad23ee2">XAXIPCIE_IM_ENABLE_ALL_MASK</a>, <a class="el" href="group__axipcie.html#ga08e3f639ed3ca042d429630fec260654">XAxiPcie_IsLinkUp</a>, <a class="el" href="group__axipcie.html#ga911e4cd0c119271f6c01c9b1ac827df1">XAxiPcie_LookupConfig()</a>, <a class="el" href="group__axipcie.html#gad9494095b9350f455af9e7da5375d522">XAxiPcie_ReadLocalConfigSpace()</a>, <a class="el" href="group__axipcie.html#ga51ee29d03fbefc82b9208f46a12d5a06">XAxiPcie_SetLocalBusBar2PcieBar()</a>, and <a class="el" href="group__axipcie.html#gafbdf9a7e71effb96353079d1c177888b">XAxiPcie_WriteLocalConfigSpace()</a>.</p>

<p>Referenced by <a class="el" href="xaxipcie__rc__cdma__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
